package view.product;

import java.awt.Color;
import java.awt.Dimension;

import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.border.TitledBorder;

import lib.MyUtils;
import controller.product.MobileControl;
import controller.product.ProductTypeController;

public class ProductMainPanel extends JPanel {
	private static final long serialVersionUID = 1L;
	private JButton btnProdAdd;
	private JButton btnProdCancel;
	private JButton btnProdDelete;
	private JButton btnProdEdit;
	private JButton btnProdLoad;
	private JButton btnProdSearch;
	private JButton btnProdUpdate;
	private JComboBox<String> cbbProdProducttype;
	private JComboBox<String> cbbProdSearchby;
	private JComboBox<String> cbbProdSupplier;
	private com.toedter.calendar.JDateChooser dateProdDate;
	private JScrollPane jScrollPane1;
	private JLabel lblProdVNDpurchase;
	private JLabel lblProdVNDsale;
	private JLabel lblProdBy;
	private JLabel lblProdDate;
	private JLabel lblProdId;
	private JLabel lblProdProductname;
	private JLabel lblProdProducttype;
	private JLabel lblProdPurchaseprice;
	private JLabel lblProdQuantity;
	private JLabel lblProdSaleprice;
	private JLabel lblProdSupplier;
	private JPanel pnProdInformation;
	private JPanel pnProdListproduct;
	private JPanel pnProdSub;
	private JTable tblProdListproduct;
	private JTextField txtProdId;
	private JPanel txtProdLoad;
	private JTextField txtProdProductname;
	private JTextField txtProdPurchaseprice;
	private JTextField txtProdQuantity;
	private JTextField txtProdSaleprice;
	private JTextField txtProdSearch;

	private ProductSubLaptop pnProdLaptop;
	private ProductSubMobileTablet pnProdMobile;
	
	private MobileControl controller;
	

	public MobileControl getController() {
		return controller;
	}

	public void setController(MobileControl controller) {
		this.controller = controller;
	}

	private JPanel pnCurrent;

	public ProductMainPanel() {
		initComponents();
		MyUtils.doLoadMobile(this);
		
		pnProdSub.setLayout(null);
		pnCurrent = pnProdMobile;

		pnProdSub.add(pnCurrent);
		pnCurrent.setBounds(0, 0, 341, 215);

		pnProdLaptop.setBackground(Color.WHITE);
		pnProdMobile.setBackground(Color.WHITE);
		cbbProdProducttype.addItemListener(new ProductTypeController(this));
	}

	public JButton getBtnProdAdd() {
		return btnProdAdd;
	}

	public void setBtnProdAdd(JButton btnProdAdd) {
		this.btnProdAdd = btnProdAdd;
	}

	public JButton getBtnProdCancel() {
		return btnProdCancel;
	}

	public void setBtnProdCancel(JButton btnProdCancel) {
		this.btnProdCancel = btnProdCancel;
	}

	public JButton getBtnProdDelete() {
		return btnProdDelete;
	}

	public void setBtnProdDelete(JButton btnProdDelete) {
		this.btnProdDelete = btnProdDelete;
	}

	public JButton getBtnProdEdit() {
		return btnProdEdit;
	}

	public void setBtnProdEdit(JButton btnProdEdit) {
		this.btnProdEdit = btnProdEdit;
	}

	public JButton getBtnProdLoad() {
		return btnProdLoad;
	}

	public void setBtnProdLoad(JButton btnProdLoad) {
		this.btnProdLoad = btnProdLoad;
	}

	public JButton getBtnProdSearch() {
		return btnProdSearch;
	}

	public void setBtnProdSearch(JButton btnProdSearch) {
		this.btnProdSearch = btnProdSearch;
	}

	public JButton getBtnProdUpdate() {
		return btnProdUpdate;
	}

	public void setBtnProdUpdate(JButton btnProdUpdate) {
		this.btnProdUpdate = btnProdUpdate;
	}

	public JComboBox<String> getCbbProdProducttype() {
		return cbbProdProducttype;
	}

	public void setCbbProdProducttype(JComboBox<String> cbbProdProducttype) {
		this.cbbProdProducttype = cbbProdProducttype;
	}

	public JComboBox<String> getCbbProdSearchby() {
		return cbbProdSearchby;
	}

	public void setCbbProdSearchby(JComboBox<String> cbbProdSearchby) {
		this.cbbProdSearchby = cbbProdSearchby;
	}

	public JComboBox<String> getCbbProdSupplier() {
		return cbbProdSupplier;
	}

	public void setCbbProdSupplier(JComboBox<String> cbbProdSupplier) {
		this.cbbProdSupplier = cbbProdSupplier;
	}

	public com.toedter.calendar.JDateChooser getDateProdDate() {
		return dateProdDate;
	}

	public void setDateProdDate(com.toedter.calendar.JDateChooser dateProdDate) {
		this.dateProdDate = dateProdDate;
	}

	public JScrollPane getjScrollPane1() {
		return jScrollPane1;
	}

	public void setjScrollPane1(JScrollPane jScrollPane1) {
		this.jScrollPane1 = jScrollPane1;
	}

	public JLabel getLblProdVNDpurchase() {
		return lblProdVNDpurchase;
	}

	public void setLblProdVNDpurchase(JLabel lblProdVNDpurchase) {
		this.lblProdVNDpurchase = lblProdVNDpurchase;
	}

	public JLabel getLblProdVNDsale() {
		return lblProdVNDsale;
	}

	public void setLblProdVNDsale(JLabel lblProdVNDsale) {
		this.lblProdVNDsale = lblProdVNDsale;
	}

	public JLabel getLblProdBy() {
		return lblProdBy;
	}

	public void setLblProdBy(JLabel lblProdBy) {
		this.lblProdBy = lblProdBy;
	}

	public JLabel getLblProdDate() {
		return lblProdDate;
	}

	public void setLblProdDate(JLabel lblProdDate) {
		this.lblProdDate = lblProdDate;
	}

	public JLabel getLblProdId() {
		return lblProdId;
	}

	public void setLblProdId(JLabel lblProdId) {
		this.lblProdId = lblProdId;
	}

	public JLabel getLblProdProductname() {
		return lblProdProductname;
	}

	public void setLblProdProductname(JLabel lblProdProductname) {
		this.lblProdProductname = lblProdProductname;
	}

	public JLabel getLblProdProducttype() {
		return lblProdProducttype;
	}

	public void setLblProdProducttype(JLabel lblProdProducttype) {
		this.lblProdProducttype = lblProdProducttype;
	}

	public JLabel getLblProdPurchaseprice() {
		return lblProdPurchaseprice;
	}

	public void setLblProdPurchaseprice(JLabel lblProdPurchaseprice) {
		this.lblProdPurchaseprice = lblProdPurchaseprice;
	}

	public JLabel getLblProdQuantity() {
		return lblProdQuantity;
	}

	public void setLblProdQuantity(JLabel lblProdQuantity) {
		this.lblProdQuantity = lblProdQuantity;
	}

	public JLabel getLblProdSaleprice() {
		return lblProdSaleprice;
	}

	public void setLblProdSaleprice(JLabel lblProdSaleprice) {
		this.lblProdSaleprice = lblProdSaleprice;
	}

	public JLabel getLblProdSupplier() {
		return lblProdSupplier;
	}

	public void setLblProdSupplier(JLabel lblProdSupplier) {
		this.lblProdSupplier = lblProdSupplier;
	}

	public JPanel getPnProdInformation() {
		return pnProdInformation;
	}

	public void setPnProdInformation(JPanel pnProdInformation) {
		this.pnProdInformation = pnProdInformation;
	}

	public JPanel getPnProdListproduct() {
		return pnProdListproduct;
	}

	public void setPnProdListproduct(JPanel pnProdListproduct) {
		this.pnProdListproduct = pnProdListproduct;
	}

	public JPanel getPnProdSub() {
		return pnProdSub;
	}

	public void setPnProdSub(JPanel pnProdSub) {
		this.pnProdSub = pnProdSub;
	}

	public JTable getTblProdListproduct() {
		return tblProdListproduct;
	}

	public void setTblProdListproduct(JTable tblProdListproduct) {
		this.tblProdListproduct = tblProdListproduct;
	}

	public JTextField getTxtProdId() {
		return txtProdId;
	}

	public void setTxtProdId(JTextField txtProdId) {
		this.txtProdId = txtProdId;
	}

	public JPanel getTxtProdLoad() {
		return txtProdLoad;
	}

	public void setTxtProdLoad(JPanel txtProdLoad) {
		this.txtProdLoad = txtProdLoad;
	}

	public JTextField getTxtProdProductname() {
		return txtProdProductname;
	}

	public void setTxtProdProductname(JTextField txtProdProductname) {
		this.txtProdProductname = txtProdProductname;
	}

	public JTextField getTxtProdPurchaseprice() {
		return txtProdPurchaseprice;
	}

	public void setTxtProdPurchaseprice(JTextField txtProdPurchaseprice) {
		this.txtProdPurchaseprice = txtProdPurchaseprice;
	}

	public JTextField getTxtProdQuantity() {
		return txtProdQuantity;
	}

	public void setTxtProdQuantity(JTextField txtProdQuantity) {
		this.txtProdQuantity = txtProdQuantity;
	}

	public JTextField getTxtProdSaleprice() {
		return txtProdSaleprice;
	}

	public void setTxtProdSaleprice(JTextField txtProdSaleprice) {
		this.txtProdSaleprice = txtProdSaleprice;
	}

	public JTextField getTxtProdSearch() {
		return txtProdSearch;
	}

	public void setTxtProdSearch(JTextField txtProdSearch) {
		this.txtProdSearch = txtProdSearch;
	}

	public ProductSubLaptop getPnProdLaptop() {
		return pnProdLaptop;
	}

	public void setPnProdLaptop(ProductSubLaptop pnProdLaptop) {
		this.pnProdLaptop = pnProdLaptop;
	}

	public ProductSubMobileTablet getPnProdMobile() {
		return pnProdMobile;
	}

	public void setPnProdMobile(ProductSubMobileTablet pnProdMobile) {
		this.pnProdMobile = pnProdMobile;
	}

	public JPanel getPnCurrent() {
		return pnCurrent;
	}

	public void setPnCurrent(JPanel pnCurrent) {
		this.pnCurrent = pnCurrent;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	private void initComponents() {
		pnProdLaptop = new ProductSubLaptop();
		pnProdMobile = new ProductSubMobileTablet();

		pnProdInformation = new JPanel();
		txtProdLoad = new JPanel();
		btnProdLoad = new JButton();
		lblProdProducttype = new JLabel();
		cbbProdProducttype = new JComboBox<String>();
		lblProdId = new JLabel();
		txtProdId = new JTextField();
		txtProdProductname = new JTextField();
		txtProdQuantity = new JTextField();
		txtProdPurchaseprice = new JTextField();
		txtProdSaleprice = new JTextField();
		cbbProdSupplier = new JComboBox<String>();
		dateProdDate = new com.toedter.calendar.JDateChooser();
		lblProdProductname = new JLabel();
		lblProdSupplier = new JLabel();
		lblProdPurchaseprice = new JLabel();
		lblProdSaleprice = new JLabel();
		lblProdQuantity = new JLabel();
		lblProdDate = new JLabel();
		lblProdVNDpurchase = new JLabel();
		lblProdVNDsale = new JLabel();
		pnProdSub = new JPanel();
		btnProdDelete = new JButton();
		btnProdUpdate = new JButton();
		btnProdEdit = new JButton();
		pnProdListproduct = new JPanel();
		jScrollPane1 = new JScrollPane();
		tblProdListproduct = new JTable();
		txtProdSearch = new JTextField();
		lblProdBy = new JLabel();
		cbbProdSearchby = new JComboBox<String>();
		btnProdSearch = new JButton();
		btnProdAdd = new JButton();
		btnProdCancel = new JButton();
		
		controller = new MobileControl(this);

		pnProdInformation.setBackground(new java.awt.Color(255, 255, 255));
		pnProdInformation.setBorder(BorderFactory.createTitledBorder(null,
				"Information", TitledBorder.DEFAULT_JUSTIFICATION,
				TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri", 1,
						12), java.awt.Color.blue));

		GroupLayout txt_prodmain_loadLayout = new GroupLayout(txtProdLoad);
		txtProdLoad.setLayout(txt_prodmain_loadLayout);
		txt_prodmain_loadLayout.setHorizontalGroup(txt_prodmain_loadLayout
				.createParallelGroup(GroupLayout.Alignment.LEADING).addGap(0,
						210, Short.MAX_VALUE));
		txt_prodmain_loadLayout.setVerticalGroup(txt_prodmain_loadLayout
				.createParallelGroup(GroupLayout.Alignment.LEADING).addGap(0,
						198, Short.MAX_VALUE));

		btnProdLoad.setIcon(new ImageIcon("icon/load.png"));
		btnProdLoad.setText("Load");

		lblProdProducttype.setFont(new java.awt.Font("Calibri", 0, 12));
		lblProdProducttype.setText("Product type:");

		cbbProdProducttype.setModel(new DefaultComboBoxModel<String>(
				new String[] { "Mobile", "Tablet", "Laptop" }));
		cbbProdProducttype.addActionListener(controller);

		lblProdId.setFont(new java.awt.Font("Calibri", 0, 12));
		lblProdId.setText("ID:");

//		cbbProdSupplier.setModel(new DefaultComboBoxModel<String>(new String[] {
//				"Item 1", "Item 2", "Item 3", "Item 4" }));
		
		
		lblProdProductname.setFont(new java.awt.Font("Calibri", 0, 12));
		lblProdProductname.setText("Product name:");

		lblProdSupplier.setFont(new java.awt.Font("Calibri", 0, 12));
		lblProdSupplier.setText("Supplier:");

		lblProdPurchaseprice.setFont(new java.awt.Font("Calibri", 0, 12));
		lblProdPurchaseprice.setText("Purchase price:");

		lblProdSaleprice.setFont(new java.awt.Font("Calibri", 0, 12));
		lblProdSaleprice.setText("Sale price:");

		lblProdQuantity.setFont(new java.awt.Font("Calibri", 0, 12));
		lblProdQuantity.setText("Quantity:");

		lblProdDate.setFont(new java.awt.Font("Calibri", 0, 12));
		lblProdDate.setText("Date:");

		lblProdVNDpurchase.setFont(new java.awt.Font("Calibri", 0, 12));
		lblProdVNDpurchase.setText("VND");

		lblProdVNDsale.setFont(new java.awt.Font("Calibri", 0, 12));
		lblProdVNDsale.setText("VND");

		GroupLayout pn_prodmain_subLayout = new GroupLayout(pnProdSub);
		pnProdSub.setLayout(pn_prodmain_subLayout);
		pn_prodmain_subLayout.setHorizontalGroup(pn_prodmain_subLayout
				.createParallelGroup(GroupLayout.Alignment.LEADING).addGap(0,
						341, Short.MAX_VALUE));
		pn_prodmain_subLayout.setVerticalGroup(pn_prodmain_subLayout
				.createParallelGroup(GroupLayout.Alignment.LEADING).addGap(0,
						0, Short.MAX_VALUE));

		btnProdDelete.setFont(new java.awt.Font("Calibri", 1, 12));
		btnProdDelete.setIcon(new ImageIcon("icon/em_delete.png"));
		btnProdDelete.setText("Delete");
		btnProdDelete.addActionListener(controller);

		btnProdUpdate.setFont(new java.awt.Font("Calibri", 1, 12));
		btnProdUpdate.setIcon(new ImageIcon("icon/save.png"));
		btnProdUpdate.setText("Update");
		btnProdUpdate.addActionListener(controller);

		btnProdEdit.setFont(new java.awt.Font("Calibri", 1, 12));
		btnProdEdit.setIcon(new ImageIcon("icon/em_edit.png"));
		btnProdEdit.setText("Edit");
		btnProdEdit.addActionListener(controller);

		GroupLayout pn_prodmain_informationLayout = new GroupLayout(
				pnProdInformation);
		pnProdInformation.setLayout(pn_prodmain_informationLayout);
		pn_prodmain_informationLayout
				.setHorizontalGroup(pn_prodmain_informationLayout
						.createParallelGroup(GroupLayout.Alignment.LEADING)
						.addGroup(
								pn_prodmain_informationLayout
										.createSequentialGroup()
										.addGroup(
												pn_prodmain_informationLayout
														.createParallelGroup(
																GroupLayout.Alignment.LEADING)
														.addGroup(
																pn_prodmain_informationLayout
																		.createSequentialGroup()
																		.addContainerGap()
																		.addComponent(
																				txtProdLoad,
																				GroupLayout.PREFERRED_SIZE,
																				GroupLayout.DEFAULT_SIZE,
																				GroupLayout.PREFERRED_SIZE))
														.addGroup(
																pn_prodmain_informationLayout
																		.createSequentialGroup()
																		.addGap(66,
																				66,
																				66)
																		.addComponent(
																				btnProdLoad,
																				GroupLayout.PREFERRED_SIZE,
																				90,
																				GroupLayout.PREFERRED_SIZE)))
										.addGap(18, 18, 18)
										.addGroup(
												pn_prodmain_informationLayout
														.createParallelGroup(
																GroupLayout.Alignment.LEADING)
														.addGroup(
																pn_prodmain_informationLayout
																		.createSequentialGroup()
																		.addGroup(
																				pn_prodmain_informationLayout
																						.createParallelGroup(
																								GroupLayout.Alignment.LEADING,
																								false)
																						.addGroup(
																								pn_prodmain_informationLayout
																										.createSequentialGroup()
																										.addGroup(
																												pn_prodmain_informationLayout
																														.createParallelGroup(
																																GroupLayout.Alignment.LEADING)
																														.addGroup(
																																pn_prodmain_informationLayout
																																		.createParallelGroup(
																																				GroupLayout.Alignment.LEADING)
																																		.addComponent(
																																				lblProdPurchaseprice,
																																				GroupLayout.Alignment.TRAILING)
																																		.addComponent(
																																				lblProdQuantity))
																														.addComponent(
																																lblProdSaleprice))
																										.addGap(10,
																												10,
																												10)
																										.addComponent(
																												txtProdPurchaseprice)
																										.addPreferredGap(
																												LayoutStyle.ComponentPlacement.UNRELATED)
																										.addComponent(
																												lblProdVNDpurchase))
																						.addGroup(
																								pn_prodmain_informationLayout
																										.createSequentialGroup()
																										.addGroup(
																												pn_prodmain_informationLayout
																														.createParallelGroup(
																																GroupLayout.Alignment.LEADING)
																														.addComponent(
																																lblProdProductname)
																														.addComponent(
																																lblProdId)
																														.addComponent(
																																lblProdSupplier)
																														.addComponent(
																																lblProdProducttype)
																														.addComponent(
																																lblProdDate))
																										.addGap(14,
																												14,
																												14)
																										.addGroup(
																												pn_prodmain_informationLayout
																														.createParallelGroup(
																																GroupLayout.Alignment.LEADING,
																																false)
																														.addComponent(
																																txtProdQuantity)
																														.addComponent(
																																cbbProdProducttype,
																																0,
																																GroupLayout.DEFAULT_SIZE,
																																Short.MAX_VALUE)
																														.addComponent(
																																dateProdDate,
																																GroupLayout.PREFERRED_SIZE,
																																118,
																																GroupLayout.PREFERRED_SIZE)
																														.addGroup(
																																GroupLayout.Alignment.TRAILING,
																																pn_prodmain_informationLayout
																																		.createSequentialGroup()
																																		.addComponent(
																																				txtProdSaleprice)
																																		.addPreferredGap(
																																				LayoutStyle.ComponentPlacement.UNRELATED)
																																		.addComponent(
																																				lblProdVNDsale))
																														.addComponent(
																																cbbProdSupplier,
																																0,
																																GroupLayout.DEFAULT_SIZE,
																																Short.MAX_VALUE)
																														.addComponent(
																																txtProdId)
																														.addComponent(
																																txtProdProductname,
																																GroupLayout.PREFERRED_SIZE,
																																164,
																																GroupLayout.PREFERRED_SIZE))))
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED,
																				30,
																				Short.MAX_VALUE)
																		.addComponent(
																				pnProdSub,
																				GroupLayout.PREFERRED_SIZE,
																				GroupLayout.DEFAULT_SIZE,
																				GroupLayout.PREFERRED_SIZE))
														.addGroup(
																pn_prodmain_informationLayout
																		.createSequentialGroup()
																		.addGap(0,
																				0,
																				Short.MAX_VALUE)
																		.addComponent(
																				btnProdEdit,
																				GroupLayout.PREFERRED_SIZE,
																				100,
																				GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				btnProdUpdate,
																				GroupLayout.PREFERRED_SIZE,
																				100,
																				GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				btnProdDelete,
																				GroupLayout.PREFERRED_SIZE,
																				100,
																				GroupLayout.PREFERRED_SIZE)))
										.addContainerGap()));
		pn_prodmain_informationLayout
				.setVerticalGroup(pn_prodmain_informationLayout
						.createParallelGroup(GroupLayout.Alignment.LEADING)
						.addGroup(
								pn_prodmain_informationLayout
										.createSequentialGroup()
										.addGroup(
												pn_prodmain_informationLayout
														.createParallelGroup(
																GroupLayout.Alignment.LEADING)
														.addGroup(
																pn_prodmain_informationLayout
																		.createSequentialGroup()
																		.addContainerGap(
																				GroupLayout.DEFAULT_SIZE,
																				Short.MAX_VALUE)
																		.addGroup(
																				pn_prodmain_informationLayout
																						.createParallelGroup(
																								GroupLayout.Alignment.BASELINE)
																						.addComponent(
																								lblProdProducttype)
																						.addComponent(
																								cbbProdProducttype,
																								GroupLayout.PREFERRED_SIZE,
																								GroupLayout.DEFAULT_SIZE,
																								GroupLayout.PREFERRED_SIZE))
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED)
																		.addGroup(
																				pn_prodmain_informationLayout
																						.createParallelGroup(
																								GroupLayout.Alignment.BASELINE)
																						.addComponent(
																								lblProdId)
																						.addComponent(
																								txtProdId,
																								GroupLayout.PREFERRED_SIZE,
																								GroupLayout.DEFAULT_SIZE,
																								GroupLayout.PREFERRED_SIZE))
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED)
																		.addGroup(
																				pn_prodmain_informationLayout
																						.createParallelGroup(
																								GroupLayout.Alignment.TRAILING)
																						.addComponent(
																								lblProdProductname)
																						.addComponent(
																								txtProdProductname,
																								GroupLayout.PREFERRED_SIZE,
																								GroupLayout.DEFAULT_SIZE,
																								GroupLayout.PREFERRED_SIZE))
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED)
																		.addGroup(
																				pn_prodmain_informationLayout
																						.createParallelGroup(
																								GroupLayout.Alignment.BASELINE)
																						.addComponent(
																								cbbProdSupplier,
																								GroupLayout.PREFERRED_SIZE,
																								GroupLayout.DEFAULT_SIZE,
																								GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								lblProdSupplier))
																		.addGap(8,
																				8,
																				8)
																		.addGroup(
																				pn_prodmain_informationLayout
																						.createParallelGroup(
																								GroupLayout.Alignment.BASELINE)
																						.addComponent(
																								txtProdPurchaseprice,
																								GroupLayout.PREFERRED_SIZE,
																								GroupLayout.DEFAULT_SIZE,
																								GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								lblProdPurchaseprice)
																						.addComponent(
																								lblProdVNDpurchase))
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED)
																		.addGroup(
																				pn_prodmain_informationLayout
																						.createParallelGroup(
																								GroupLayout.Alignment.BASELINE)
																						.addComponent(
																								txtProdSaleprice,
																								GroupLayout.PREFERRED_SIZE,
																								GroupLayout.DEFAULT_SIZE,
																								GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								lblProdSaleprice)
																						.addComponent(
																								lblProdVNDsale))
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED)
																		.addGroup(
																				pn_prodmain_informationLayout
																						.createParallelGroup(
																								GroupLayout.Alignment.LEADING)
																						.addComponent(
																								lblProdQuantity)
																						.addComponent(
																								txtProdQuantity,
																								GroupLayout.Alignment.TRAILING,
																								GroupLayout.PREFERRED_SIZE,
																								GroupLayout.DEFAULT_SIZE,
																								GroupLayout.PREFERRED_SIZE))
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED)
																		.addGroup(
																				pn_prodmain_informationLayout
																						.createParallelGroup(
																								GroupLayout.Alignment.LEADING)
																						.addComponent(
																								dateProdDate,
																								GroupLayout.PREFERRED_SIZE,
																								GroupLayout.DEFAULT_SIZE,
																								GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								lblProdDate)))
														.addComponent(
																pnProdSub,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.DEFAULT_SIZE,
																Short.MAX_VALUE))
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												pn_prodmain_informationLayout
														.createParallelGroup(
																GroupLayout.Alignment.BASELINE)
														.addComponent(
																btnProdDelete,
																GroupLayout.PREFERRED_SIZE,
																25,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btnProdUpdate,
																GroupLayout.PREFERRED_SIZE,
																25,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btnProdEdit,
																GroupLayout.PREFERRED_SIZE,
																25,
																GroupLayout.PREFERRED_SIZE)))
						.addGroup(
								pn_prodmain_informationLayout
										.createSequentialGroup()
										.addComponent(txtProdLoad,
												GroupLayout.PREFERRED_SIZE,
												GroupLayout.DEFAULT_SIZE,
												GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.RELATED,
												GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)
										.addComponent(btnProdLoad)
										.addContainerGap()));

		pnProdListproduct.setBackground(new java.awt.Color(255, 255, 255));
		pnProdListproduct.setBorder(BorderFactory.createTitledBorder(null,
				"List Product", TitledBorder.DEFAULT_JUSTIFICATION,
				TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri", 1,
						12), java.awt.Color.blue));

		tblProdListproduct.setFont(new java.awt.Font("Calibri", 0, 12));
//		tblProdListproduct.setModel(new DefaultTableModel(new Object[][] {
//				{ null, null, null, null, null, null },
//				{ null, null, null, null, null, null } }, new String[] { "ID",
//				"Product name", "Supplier", "Purchase price", "Sale price",
//				"Quantity" }));

		tblProdListproduct.addMouseListener(controller);
		jScrollPane1.setViewportView(tblProdListproduct);

		lblProdBy.setText("by");

		cbbProdSearchby.setModel(new DefaultComboBoxModel<String>(new String[] {
				"name", "infor" }));

		btnProdSearch.setFont(new java.awt.Font("Calibri", 1, 12));
		btnProdSearch.setIcon(new ImageIcon("icon/search.png"));
		btnProdSearch.setText("Search");
		btnProdSearch.addActionListener(controller);

		btnProdAdd.setFont(new java.awt.Font("Calibri", 1, 15));
		btnProdAdd.setIcon(new ImageIcon("icon/add.png"));
		btnProdAdd.setText("Add");
		btnProdAdd.setToolTipText("");
		btnProdAdd.addActionListener(controller);

		btnProdCancel.setFont(new java.awt.Font("Calibri", 1, 15));
		btnProdCancel.setIcon(new ImageIcon("icon/clear.png"));
		btnProdCancel.setText("Clear");
		btnProdCancel.addActionListener(controller);

		GroupLayout pn_prodmain_listproductLayout = new GroupLayout(
				pnProdListproduct);
		pnProdListproduct.setLayout(pn_prodmain_listproductLayout);
		pn_prodmain_listproductLayout
				.setHorizontalGroup(pn_prodmain_listproductLayout
						.createParallelGroup(GroupLayout.Alignment.LEADING)
						.addGroup(
								GroupLayout.Alignment.TRAILING,
								pn_prodmain_listproductLayout
										.createSequentialGroup()
										.addContainerGap(
												GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)
										.addComponent(txtProdSearch,
												GroupLayout.PREFERRED_SIZE,
												151, GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(lblProdBy)
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(cbbProdSearchby,
												GroupLayout.PREFERRED_SIZE, 79,
												GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(btnProdSearch,
												GroupLayout.PREFERRED_SIZE, 90,
												GroupLayout.PREFERRED_SIZE)
										.addContainerGap())
						.addComponent(jScrollPane1,
								GroupLayout.Alignment.TRAILING,
								GroupLayout.DEFAULT_SIZE, 874, Short.MAX_VALUE)
						.addGroup(
								pn_prodmain_listproductLayout
										.createSequentialGroup()
										.addGap(317, 317, 317)
										.addComponent(btnProdAdd,
												GroupLayout.PREFERRED_SIZE, 90,
												GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(btnProdCancel)
										.addContainerGap(
												GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)));
		pn_prodmain_listproductLayout
				.setVerticalGroup(pn_prodmain_listproductLayout
						.createParallelGroup(GroupLayout.Alignment.LEADING)
						.addGroup(
								GroupLayout.Alignment.TRAILING,
								pn_prodmain_listproductLayout
										.createSequentialGroup()
										.addGroup(
												pn_prodmain_listproductLayout
														.createParallelGroup(
																GroupLayout.Alignment.BASELINE)
														.addComponent(
																txtProdSearch,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(lblProdBy)
														.addComponent(
																cbbProdSearchby,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btnProdSearch))
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(jScrollPane1,
												GroupLayout.DEFAULT_SIZE, 102,
												Short.MAX_VALUE)
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												pn_prodmain_listproductLayout
														.createParallelGroup(
																GroupLayout.Alignment.BASELINE)
														.addComponent(
																btnProdAdd,
																GroupLayout.PREFERRED_SIZE,
																25,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btnProdCancel,
																GroupLayout.PREFERRED_SIZE,
																25,
																GroupLayout.PREFERRED_SIZE))));

		GroupLayout layout = new GroupLayout(this);
		this.setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(
				GroupLayout.Alignment.LEADING).addGroup(
				layout.createSequentialGroup()
						.addContainerGap()
						.addGroup(
								layout.createParallelGroup(
										GroupLayout.Alignment.LEADING)
										.addComponent(pnProdInformation,
												GroupLayout.DEFAULT_SIZE,
												GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)
										.addComponent(pnProdListproduct,
												GroupLayout.DEFAULT_SIZE,
												GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE))
						.addContainerGap()));
		layout.setVerticalGroup(layout.createParallelGroup(
				GroupLayout.Alignment.LEADING).addGroup(
				layout.createSequentialGroup()
						.addContainerGap()
						.addComponent(pnProdInformation,
								GroupLayout.PREFERRED_SIZE,
								GroupLayout.DEFAULT_SIZE,
								GroupLayout.PREFERRED_SIZE)
						.addGap(3, 3, 3)
						.addComponent(pnProdListproduct,
								GroupLayout.PREFERRED_SIZE,
								GroupLayout.DEFAULT_SIZE,
								GroupLayout.PREFERRED_SIZE)));
		pnProdSub.setMinimumSize(new Dimension(341, 215));
		pnProdSub.setPreferredSize(new Dimension(341, 215));
		pnProdSub.setSize(pnProdSub.getPreferredSize());

	}

}
